package 建造者模式;

//监工
public class Derictor {
    //将一个复杂的过程与其表象相分离
    private Buildr buildr;

    //针对接口编程而不是针对实现编程
    public Derictor(Buildr buildr) {
        this.buildr = buildr;
    }

    public void setBuildr(Buildr buildr) {
        this.buildr = buildr;
    }

    public void construct() {
        buildr.builderpatr1();
        for (int i = 0; i < 5; i++) {
            //提示如果想在运行过程中替换构建算法可以考虑结合策略模式
            buildr.builderpatr2();
        }
        buildr.builderpatr3();
    }
}
